﻿


function SetPageBakguand(ojb) {
    var hmtl = "";
    var name = localStorage.getItem("UserName");
    var myDate = new Date();
    var datetime = myDate.toLocaleDateString() + ' ' + myDate.toLocaleTimeString();
    for (var i = 0; i < 20; i++) {
        hmtl += "<em>" + name + "  " + datetime + "</em>";
    }
    ojb.html(hmtl);
}

function lodshoplist(val) {
    //加载门店
    $("#js_shop").html("加载数据中...")
    $.post(url_path + "/index.aspx",
                    { aciton: 'lodshoplist', shopname: val },
                     function (data) {
                         var msg = $.trim(data);
                         var html = '<table id="chkblist" class="slOption"><tbody>';
                         if (msg == "NO_DATA") {
                             html = "<tr><td>没有数据！</td></tr>"
                         } else {
                             var orderObj = JSON.parse(msg);
                             for (var i = 0; i < orderObj.length; i++) {
                                 html += '<tr><td><input name = "chkSon" type="checkbox" value="' + orderObj[i].shopid + '">' +
                                 '<label>' + orderObj[i].shopname + '</label></td></tr>';
                             }
                         }
                         html += '</tbody></table>';
                         $("#js_shop").html(html);
                         $('#js_shop input[type="checkbox"]').each(function () {
                             $(this).click(function () {
                                 var val = $('#business').val();
                                 var chkVal = $(this).val();
                                 if ($(this).attr('checked') == 'checked') {
                                     $('#business').val(val + chkVal + ';');
                                 }
                                 else {
                                     var result = val.replace(chkVal + ';', '');
                                     $('#business').val(result);
                                 }
                             })
                         });
                     });
}